<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function Father(uname, age) {
        this.uname = uname
        this.age = age
      }
      Father.prototype.dance = function () {
        console.log('跳舞')
      }

      function Son(uname, age) {
        Father.call(this, uname, age)
      }
      // Son.prototype = new Father()
      // Son.prototype = Father.prototype
      Son.prototype.__proto__ = Father.prototype
      Son.prototype.constructor = Son

      const father = new Father('ls', 30)
      const son = new Son('zs', 20)

      console.log(father)
      console.log(son)
      son.dance()
    </script>
  </body>
</html>
